From: Keir Fraser Date: Wed, 9 Jul 2008 10:02:37 +0000 (+0100) Subject: x86 p2m superpage fix: Re-insert missing shadow code from the original X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14188^2~74 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ce3e2dbb9b90a748c193501a8ab90a17e6235512;p=xen.git x86 p2m superpage fix: Re-insert missing shadow code from the original patch that was submitted to xen-devel, to remove mappings when we're removing a p2m 2mb page. Signed-off-by: Gianluca Guida --- diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 20252a2f91..0a99435601 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -3354,6 +3354,26 @@ shadow_write_p2m_entry(struct vcpu *v, unsigned long gfn, } } + /* If we're removing a superpage mapping from the p2m, remove all the + * MFNs covered by it from the shadows too. */ + if ( level == 2 && (l1e_get_flags(*p) & _PAGE_PRESENT) && + (l1e_get_flags(*p) & _PAGE_PSE) ) + { + unsigned int i; + mfn_t mfn = _mfn(l1e_get_pfn(*p)); + p2m_type_t p2mt = p2m_flags_to_type(l1e_get_flags(*p)); + if ( p2m_is_valid(p2mt) && mfn_valid(mfn) ) + { + for ( i = 0; i < L1_PAGETABLE_ENTRIES; i++ ) + { + sh_remove_all_shadows_and_parents(v, mfn); + if ( sh_remove_all_mappings(v, mfn) ) + flush_tlb_mask(d->domain_dirty_cpumask); + mfn = _mfn(mfn_x(mfn) + 1); + } + } + } + /* Update the entry with new content */ safe_write_pte(p, new);